package com.itheima.reggie.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.reggie.dto.OrdersDto;
import com.itheima.reggie.pojo.OrderDetail;
import com.itheima.reggie.pojo.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {

    /**
     * 自定义分页查询订单
     */
    Page<OrdersDto> selectByPage(Page<OrdersDto> pageInfo);


    @Select("select * from order_detail od where od.order_id=#{id}")
    List<OrderDetail> selectDetail(Long id);

    /**
     * 客户端带条件分页查询
     */
    Page<OrdersDto> getByPage(Page<OrdersDto> pageInfo, String number, LocalDateTime beginTime, LocalDateTime endTime);
}
